Package excel.headerfooter

Source Code of excel.headerfooter.ApacheHeaderFooter

package excel.headerfooter;

import java.io.FileOutputStream;

import org.apache.poi.hssf.usermodel.HSSFHeader;
import org.apache.poi.hssf.usermodel.HSSFWorkbook;
import org.apache.poi.ss.usermodel.Header;
import org.apache.poi.ss.usermodel.Sheet;
import org.apache.poi.ss.usermodel.Workbook;

public class ApacheHeaderFooter
{
  public static void main(String[] args) throws Exception
  {
    Workbook wb = new HSSFWorkbook();
      Sheet sheet = wb.createSheet("new sheet");

      Header header = sheet.getHeader();
      header.setCenter("Center Header");
      header.setLeft("Left Header");
      header.setRight(HSSFHeader.font("Stencil-Normal", "Italic") +
                      HSSFHeader.fontSize((short) 16) + "Right w/ Stencil-Normal Italic font and size 16");

      FileOutputStream fileOut = new FileOutputStream("data/ApacheHeaderFooter.xls");
      wb.write(fileOut);
      fileOut.close();
  }
}
TOP

Related Classes of excel.headerfooter.ApacheHeaderFooter

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.